import request from '@/utils/request.js'

// 查询商户车辆列表
export function listVehicle(query) {
  return request({
    url: '/system/vehicle/list',
    method: 'get',
    params: query
  })
}

// 查询商户所有车辆（不分页）
export function listAllVehicle() {
  return request({
    url: '/system/vehicle/listAll',
    method: 'get'
  })
}

// 查询车辆详情
export function getVehicle(vehicleId) {
  return request({
    url: '/system/vehicle/get/' + vehicleId,
    method: 'get'
  })
}

// 新增车辆
export function addVehicle(data) {
  return request({
    url: '/system/vehicle',
    method: 'post',
    data: data
  })
}

// 修改车辆
export function updateVehicle(data) {
  return request({
    url: '/system/vehicle',
    method: 'put',
    data: data
  })
}

// 删除车辆
export function delVehicle(vehicleId) {
  return request({
    url: '/system/vehicle/' + vehicleId,
    method: 'delete'
  })
}

// 设置默认车辆
export function setDefaultVehicle(vehicleId) {
  return request({
    url: '/system/vehicle/setDefault/' + vehicleId,
    method: 'put'
  })
}

// 获取默认车辆
export function getDefaultVehicle() {
  return request({
    url: '/system/vehicle/default',
    method: 'get'
  })
}